package com.usian.r;

import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class R<T> {
    /**
     * 状态码 1.成功
     *        2.失败
     */
    private String code;
    /**
     * 返回提示信息“查询成功”
     */
    private String message;

    private T data;

    public static R success(Object data){
        R resultResponse = new R<Object>();
        resultResponse.setCode("1");
        resultResponse.setMessage("SUCCESS");
        resultResponse.setData(data);
        return resultResponse;
    }

    public static R error(){
        R resultResponse = new R<Object>();
        resultResponse.setCode("2");
        resultResponse.setMessage("ERROR");
        return resultResponse;
    }
}
